package com.angel.util;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringUtil {
	public static Boolean checkPhoneNum(String num){
		String regExp="^((13[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$";
		Pattern pattern=Pattern.compile(regExp);
		Matcher match=pattern.matcher(num);
		return match.find();
	}
	/*判断字符串是否为空,null,转移字符，回车换行符*/
	public static Boolean isBlank(String value){
		boolean blank=true;
		if(value.equals("")||value==null){
			return blank;
		}else{
			for(int i=0;i<value.length();i++){
				char c=value.charAt(i);
				if(c==' '||c=='\r'||c=='\n'){
					return blank;
				}
		}
	    }
	    return false;
	}
	
	 /**返回字符串中URL地址集合
	 * @param url
	 * @return
	 */
	public static List checkURLList(String url){
			   String regExp="(http|ftp|https):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&amp;:/~\\+#]*[\\w\\-\\@?^=%&amp;/~\\+#])?";
			   Pattern pattern=Pattern.compile(regExp);
			   Matcher m=pattern.matcher(url);
			   
			   String urls="";
			    List<String> list=new ArrayList<String>(3);
			   while(m.find()){
				  urls= m.group();
				  list.add(urls);
			   }
			   
			   return list;
	 }
}
